package com.jshan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jshan.base.entity.SystemInfo;
import com.jshan.mapper.SystemInfoMapper;
import com.jshan.service.SystemInfoService;
import org.springframework.stereotype.Service;

@Service
public class SystemInfoServiceImpl extends ServiceImpl<SystemInfoMapper, SystemInfo> implements SystemInfoService {

    @Override
    public SystemInfo getSystemInfo(Long serverId) {
        LambdaQueryWrapper<SystemInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SystemInfo::getServerId, serverId)
                .orderByDesc(SystemInfo::getCreateTime)
                .last("LIMIT 1");
        return getOne(wrapper);
    }
}
